﻿namespace SmallGeo;

/// <summary>
/// 表示点与面的分析结果
/// </summary>
public struct PointWithPolygonResult
{
    public EnumPointWithPolygon Flag { get; set; }
    public bool IsInside() => Flag == EnumPointWithPolygon.IsInside;
    public bool IsOutside() => Flag == EnumPointWithPolygon.IsOutside;
    public bool IsOn() => Flag == EnumPointWithPolygon.IsOnEdge || Flag == EnumPointWithPolygon.IsOnCorner;

    /// <summary>
    /// 点在面上时, 与面相交的点, 此点通过面的点位计算得到
    /// </summary>
    public Vector2d CrossPoint { get; set; }

    /// <summary>
    /// 当点在面上时, 得出的点与哪个点重合,或在哪个边上
    /// </summary>
    public int PointIndex { get; set; }
}
